function exp_NBA_CARE()
    h=figure(1);
    figure_CARE();
    h=figure(2);
    figure_SLICE();
    test_NBA();
end

function test_NBA()
    savfilename='test_nba.txt';
    load('nba2.mat','gp','minutes','reb','ast','stl');
    data=[minutes,ast,reb];
    [corrplanes,sups]=CARE(data, 3, 0.0006,  0.5);
    corratts={}; 
    for i=1:length(corrplanes)
        corratts{i}=[1,2,3];
    end
    displaycorrelations(corrplanes,sups,corratts,0.01, savfilename);
end

function figure_CARE()
    load('nba2.mat','gp','minutes','reb','ast','stl');
    data=[minutes,ast,reb];
    grid on;
    [x,y] = meshgrid(0:4000:4000);
    y=[0,0;700,700];
    %y=y-200;
    z = (0.090645*x-0.976344*y-0.796832)/0.196303;    
    surf(x,y,z,'FaceColor','yellow','FaceAlpha',0.3);
    hold on;
    plot3(data(:,1),data(:,2),data(:,3),'r.');
    hold on;
end

function figure_SLICE()
    load('nba2.mat','gp','minutes','reb','ast','stl');
    data=[minutes,ast,reb];
    grid on;
    [x,y] = meshgrid(0:4000:4000);
    y=[0,0;700,700];
    %y=y-200;
    z = (-0.059304*x+0.998230*y+4.891474)/0.004374;    
    surf(x,y,z,'FaceColor','yellow','FaceAlpha',0.3);
    hold on;
    z = (0.102611*x-0.102230*y+5.202053)/0.989454;
    surf(x,y,z,'FaceColor','green','FaceAlpha',0.3);
    hold on;
    plot3(data(:,1),data(:,2),data(:,3),'r.');
    hold on;
end
